package controllers

import (
	"github.com/astaxie/beego"
	"github.com/astaxie/beego/orm"
)

type WishController struct {
	beego.Controller
}

func init() {
	orm.RegisterModel(new(Wish))
}
type Wish struct {
	Id int
	Content string
	User_id int
}
func (this *WishController) Edit() {
	o := orm.NewOrm()
	content := this.GetString("content")
	id, _ := this.GetInt("id")
	_, err := o.Raw("UPDATE wish SET content = ? where id=?", content,id).Exec()
	if err == nil {
		res := success{0,"修改成功", ""}
		this.Data["json"] = res
	}else{
		res := fail{0,"修改失败"}
		this.Data["json"] = res
	}

	this.ServeJSON()
}



